using Godot;
using RPG01.Scripts.SateMachine;

namespace RPG01.Scripts.Character.Player;

public class PlayerMoveState : State
{
    public PlayerMoveState(Player player, StateMachine stateMachine) : base(player, stateMachine)
    {
    }

    public override void Enter()
    {
        base.Enter();
        player.PlayAnimation("move");
    }

    public override void Process(double delta)
    {
        base.Process(delta);
    }

    public override void PhysicsProcess(double delta)
    {
        base.PhysicsProcess(delta);
        Vector2 moveDirection = player.GetMoveInput();
        player.AddMovement(moveDirection);
        
        if (moveDirection == Vector2.Zero)
        {
            stateMachine.SwitchState<PlayerIdleState>();
            return;
        }
        
        

    }

    public override void Exit()
    {
        base.Exit();
    }
}